package com.zqh.app.manager.impl;

import com.zqh.app.dao.WarehouseMapper;
import com.zqh.app.entity.Message;
import com.zqh.app.entity.SungoArticle;
import com.zqh.app.entity.SysWarehouse;
import com.zqh.app.manager.WarehouseManager;
import com.zqh.common.entity.Page;
import com.zqh.common.entity.Query;
import com.zqh.common.entity.R;
import com.zqh.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("WarehouseManager")
public class WarehouseManagerImpl implements WarehouseManager {

    @Autowired
    WarehouseMapper warehouseMapper;

    @Override
    public R addWarehouse(Query form) {
        int count = warehouseMapper.save(form);
        return CommonUtils.msg(count);
    }

    @Override
    public List<SysWarehouse> getWarehouse(Page<SysWarehouse> page, Query form) {
        return warehouseMapper.listForPage(page,form);
    }

    @Override
    public R upWarehouse(Query form) {
        int count = warehouseMapper.update(form);
        return CommonUtils.msg(count);
    }

    @Override
    public R upWarehouses(List<SysWarehouse> form) {
        int count = warehouseMapper.batchUpdate(form);
        return CommonUtils.msg(count);
    }

}
